package com.acme.business;

import java.util.List;

import com.acme.data.ParentDao;
import com.acme.domain.Parent;

/**
 * A sample business object that manipulates Parent & Child objects
 * Methods in this class are enlisted in a transaction (see applicationContext.xml)
 * 
 * @author sjavey
 *
 */
public class DefaultWorkManager {

	private ParentDao parentDao;

	public ParentDao getParentDao() {
		return parentDao;
	}

	public void setParentDao(ParentDao parentDao) {
		this.parentDao = parentDao;
	}

	public List<Parent> getAllParents() {
		return parentDao.getAll();
	}
	
	public void saveParentAndThrowException(Parent p) {
		parentDao.save(p);
		//oops something has gone wrong
		throw new RuntimeException("oops!");
	}

}
